
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    
<head>   
   

    <script type="text/javascript" src="http://c.csdnimg.cn/pubfooter/js/tracking.js" charset="utf-8"></script>  

    <script type="text/javascript">
        var protocol = window.location.protocol;
        document.write('<script type="text/javascript" src="' + protocol + '//csdnimg.cn/pubfooter/js/repoAddr2.js?v=' + Math.random() + '"></' + 'script>');
    </script>

  
 <meta http-equiv="Cache-Control" content="no-siteapp" /><link rel="alternate" media="handheld" href="#" />

    <title>BroadcastReceiver详解 - 启舰
        - 博客频道 - CSDN.NET</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="在Form1_Load事件中添加" />
    <script src="http://static.blog.csdn.net/scripts/jquery.js" type="text/javascript"></script>
      <script type="text/javascript" src="http://static.blog.csdn.net/scripts/jquery-version.js"></script>
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/ad.js?v=1.1"></script>
        <!--new top-->
               <link rel="stylesheet" href="http://c.csdnimg.cn/public/common/toolbar/css/index.css">        <!--new top-->
    
      <!-- ad begin -->
         <script language="javascript" type="text/javascript" src="http://ads.csdn.net/js/tracking.js"></script>
    <!-- ad end-->

    <link rel="Stylesheet" type="text/css" href="http://static.blog.csdn.net/skin/default/css/style.css?v=1.1" />
    <link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="/harvic880925/rss/list" />
    <link rel="shortcut icon" href="http://c.csdnimg.cn/public/favicon.ico" />
    <link type="text/css" rel="stylesheet" href="http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css" />
 


<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?6bcd52f51e9b3dce32bec4a3997715ac";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

</head>
<body>
    <!-- 广告位开始 -->
        <ins data-revive-zoneid="149" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>
    <!-- 广告位结束 -->

    
   
      <!--new top-->
    <script id="toolbar-tpl-scriptId" fixed="true" prod="blog" skin="black" src="http://c.csdnimg.cn/public/common/toolbar/js/html.js" type="text/javascript"></script>
     <!--new top-->
    <div id="container">
        <div id="header">
    <div class="header">
        <div id="blog_title">
            <h2>
                <a href="http://blog.csdn.net/harvic880925">启舰</a></h2>
            <h3>当乌龟有了梦想……</h3>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
        
     
    </div>
</div>
<div id="navigator">
    <div class="navigator_bg">
    </div>
    <div class="navigator">
        <ul>           
                <li id="btnContents"><a href="http://blog.csdn.net/harvic880925?viewmode=contents"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_mulu'])">
                    <img src="http://static.blog.csdn.net/images/ico_list.gif">目录视图</span></a></li>
                <li id="btnView"><a href="http://blog.csdn.net/harvic880925?viewmode=list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_zhaiyao'])">
                    <img src="http://static.blog.csdn.net/images/ico_summary.gif">摘要视图</span></a></li>
                <li id="btnRss"><a href="http://blog.csdn.net/harvic880925/rss/list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_RSS'])">
                    <img src="http://static.blog.csdn.net/images/ico_rss.gif">订阅</span></a></li>                
            

            </ul>
    </div>
</div>
<script type="text/javascript">
    var username = "harvic880925";
    var _blogger = username;
    var blog_address = "http://blog.csdn.net/harvic880925";
    var static_host = "http://static.blog.csdn.net";
    var currentUserName = "";  
</script>

        <div id="body">
            <div id="main">
                <div class="main">
                        <div class="ad_class">
<div class="notice tracking-ad" data-mod='popu_3' > 
<a href="http://geek.csdn.net/news/detail/126445">
<font color=red>聚焦行业最佳实践，BDTC 2016完整议程公布
</font></a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://huiyi.csdn.net/activity/product/goods_list?project_id=3287">
<font color=blue>微信小程序实战项目——点餐系统
</font></a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://blog.csdn.net/turingbooks/article/details/53079366">
<font color=red>程序员11月书讯，评论得书啦 
</font></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://geek.csdn.net/news/detail/110921">
<font color=blue>Get IT技能知识库，50个领域一键直达
</font></a>


</font></a>
</font></a>
</div>                        </div>
                        


<!-- 广告位开始 -->
<ins data-revive-zoneid="72" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>
<!-- 广告位结束 -->

  
<link href="http://static.blog.csdn.net/css/comment1.css" type="text/css" rel="stylesheet" />
<link href="http://static.blog.csdn.net/css/style1.css" type="text/css" rel="stylesheet" />
<script language='JavaScript' type='text/javascript' src='http://download.csdn.net/js/jquery.cookie.js'></script>
<script type="text/javascript" src="http://c.csdnimg.cn/rabbit/search-service/main.js"></script>
<link rel="stylesheet" href="http://static.blog.csdn.net/public/res-min/markdown_views.css?v=1.0" />
<link rel="stylesheet" href="http://static.blog.csdn.net/css/category.css?v=1.0" />
<script type="text/javascript" src="http://static.blog.csdn.net/public/res/bower-libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/web-storage-cache.min.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/replace.min.js"></script>




  <script type="text/ecmascript">
      window.quickReplyflag = true;
           
            var isBole = false;
            
          
    </script>
<div id="article_details" class="details">
    <div class="article_title">   
         <span class="ico ico_type_Original"></span>


    <h1>
        <span class="link_title"><a href="/harvic880925/article/details/38710901">
        BroadcastReceiver详解            
        </a></span>
    </h1>
</div>

   

        <div class="article_manage clearfix">
        <div class="article_r">
            <span class="link_postdate">2014-08-20 19:42</span>
            <span class="link_view" title="阅读次数">12049人阅读</span>
            <span class="link_comments" title="评论次数"> <a href="#comments" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_pinglun'])">评论</a>(6)</span>
            <span class="link_collect tracking-ad" data-mod="popu_171"> <a href="javascript:void(0);" onclick="javascript:collectArticle('BroadcastReceiver详解','38710901');return false;" title="收藏">收藏</a></span>
             <span class="link_report"> <a href="#report" onclick="javascript:report(38710901,2);return false;" title="举报">举报</a></span>

        </div>
    </div>
    <div class="embody"  style="display:none" id="embody">
        <span class="embody_t">本文章已收录于：</span>
        <div class="embody_c" id="lib" value="{&quot;err&quot;:0,&quot;msg&quot;:&quot;ok&quot;,&quot;data&quot;:[]}"></div>
    </div>
    <style type="text/css">        
            .embody{
                padding:10px 10px 10px;
                margin:0 -20px;
                border-bottom:solid 1px #ededed;                
            }
            .embody_b{
                margin:0 ;
                padding:10px 0;
            }
            .embody .embody_t,.embody .embody_c{
                display: inline-block;
                margin-right:10px;
            }
            .embody_t{
                font-size: 12px;
                color:#999;
            }
            .embody_c{
                font-size: 12px;
            }
            .embody_c img,.embody_c em{
                display: inline-block;
                vertical-align: middle;               
            }
             .embody_c img{               
                width:30px;
                height:30px;
            }
            .embody_c em{
                margin: 0 20px 0 10px;
                color:#333;
                font-style: normal;
            }
    </style>
    <script  type="text/javascript">
        $(function () {
            try
            {
                var lib = eval("("+$("#lib").attr("value")+")");
                var html = "";
                if (lib.err == 0) {
                    $.each(lib.data, function (i) {
                        var obj = lib.data[i];
                        //html += '<img src="' + obj.logo + '"/>' + obj.name + "&nbsp;&nbsp;";
                        html += ' <a href="' + obj.url + '" target="_blank">';
                        html += ' <img src="' + obj.logo + '">';
                        html += ' <em><b>' + obj.name + '</b></em>';
                        html += ' </a>';
                    });
                    if (html != "") {
                        setTimeout(function () {
                            $("#lib").html(html);                      
                            $("#embody").show();
                        }, 100);
                    }
                }      
            } catch (err)
            { }
            
        });
    </script>
      <div class="category clearfix">
        <div class="category_l">
           <img src="http://static.blog.csdn.net/images/category_icon.jpg">
            <span>分类：</span>
        </div>
        <div class="category_r">
                    <label  onclick="GetCategoryArticles('1707319','harvic880925','top','38710901');">
                        <span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">5、andriod开发<em>（148）</em></span>
                      <img class="arrow-down" src="http://static.blog.csdn.net/images/arrow_triangle _down.jpg" style="display:inline;">
                      <img class="arrow-up" src="http://static.blog.csdn.net/images/arrow_triangle_up.jpg" style="display:none;">
                        <div class="subItem">
                            <div class="subItem_t"><a  href="http://blog.csdn.net/harvic880925/article/category/1707319"  target="_blank">作者同类文章</a><i class="J_close">X</i></div>
                            <ul class="subItem_l" id="top_1707319">                            
                            </ul>
                        </div>
                    </label>                    
        </div>
    </div>
    <script   type="text/javascript" src="http://static.blog.csdn.net/scripts/category.js"></script>  
        <div   class="bog_copyright">         
            <p  class="copyright_p" >版权声明：本文为博主原创文章，未经博主允许不得转载。</p>
        </div>

  

  
  
     

<div id="article_content" class="article_content">
<p><span style="font-family:FangSong_GB2312;color:#006600;">前言：这个月写的博客文章数量比较多，因为刚入门的缘故吧，多总结，由浅入深，等后面更深入了再给大家写续篇。</span></p><p><br /></p><p><strong><span style="color:#660000;">学之广在于不倦，不倦在于固志。 ——晋·葛洪­</span></strong><br /></p><p><span style="color:#006600;">（学问的渊博在于学习时不知道厌倦，而学习不知厌倦在于有坚定的目标）</span></p><p><br /></p><h2>一、概述</h2><p><span style="font-family: Arial; font-size: 14px; line-height: 26px;">BroadcastReceiver：直译是“广播接收者”，所以它的作用是用来接收发送过来的广播的。</span><br /></p><p>那我们有必要知道：什么是广播。广播，我的理解就是系统中消息的一种变种；就是当一个事件发生时，比如，系统突然断网，系统就发一个广播消息给所有的接收者，所有的接收者在得到这个消息之后，就知道，啊哦，现在没网络了，我的程序应该怎么办，比如显示默认图片、提示用户等。前面，我们说了，<span style="font-family: Arial; font-size: 14.44444465637207px; line-height: 26px;">BroadcastReceiver就是一个广播消息接收者。</span></p><p>另外我还要提一下，广播之间信息的传递是通过Intent对象来传递的；在<a target=_blank target="_blank" href="http://blog.csdn.net/harvic880925/article/details/38399723">《详解Intent》</a>系列文章中，我讲了，Intent调用分为显示调用的隐式调用两种，由于这里能通知到所有的接收者，所以肯定不能利用显示调用，只有利用隐式调用Intent对象了。（这里的隐式调用，并不是真正意义上的Intent隐式调用，因为Intent隐式调用，当出现很多匹配应用时，会以列表形式提示用户选择一个启动，而这里不同的地方在于，当有很多匹配项时，会给所有的匹配项都发一个消息，我说隐式调用，只是方便大家理解构造Intent的方法，即必须利用构造隐式Intent的方法来构造）</p><p><br /></p><h2>二、注册相关</h2><p><br /></p><h3>1、静态注册实例程序&nbsp;</h3><p>大家可能会问，什么叫静态注册实例程序，<span style="font-size: 12px;">先不要管上面的标题，慢慢往下看，后面在讲动态注册时会再提到。</span></p><p><strong>先构造一个接收器：</strong></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_1_882799"  code_snippet_id="454999" snippet_file_name="blog_20140821_1_882799" name="code" class="java">public class MyReceiver extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		String msg = intent.getStringExtra(&quot;msg&quot;);  
        Log.i(TAG, &quot;MyReceiver：&quot;+msg);  
        
	}

}</pre>直接派生自BroadcastReceiver，在OnReceive（）函数中进行处理即可，我们前面说了，广播的传递是靠Intent的，OnReceive的第二个参数，就是广播传过来的Intent，因为后面我们在发送广播时，会利用PutStringExtra放进去一个标识为msg的字符串，所以这里我们可以利用GetStringExtra把这个字符串取出来。然后用Log标记下这个类接收到了这个消息，以便我们跟踪。<br />大家可能会想，就这么着，就能收到广播了？当然不是，上面我们说了，通过隐式Intent来发送广播的，我们肯定要匹配这个Intent啊，匹配Intent的术语是Activity中的，在广播这里，叫要注册，也就是要注册一下，什么样的Intent能接收。<p></p><p><strong>MyReceiver的广播接收&nbsp;注册代码如下：（静态注册）</strong></p><p></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_2_5871217"  code_snippet_id="454999" snippet_file_name="blog_20140821_2_5871217" name="code" class="html">&lt;receiver android:name=&quot;.MyReceiver&quot;&gt;
	&lt;intent-filter&gt;
		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
	&lt;/intent-filter&gt;
&lt;/receiver&gt;</pre>android:name:对应接收器的类名；我们自定义的类名叫MyReceiver ，所以这里写&quot;.MyReceiver&nbsp;<span style="font-size: 12px;">&quot;</span><p></p><p><span style="font-size: 12px;">intent-filter标签里，同样是必须的两项:action和category；我在这里自定义了action的名字，等下隐式发送通过时，就是利用匹配action来接收通知的。</span></p><p>此时的AndroidManifest.xml全部内容为：</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_3_4447685"  code_snippet_id="454999" snippet_file_name="blog_20140821_3_4447685" name="code" class="html">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.example.test_brocast_blog&quot;
    android:versionCode=&quot;1&quot;
    android:versionName=&quot;1.0&quot; &gt;

    &lt;uses-sdk
        android:minSdkVersion=&quot;14&quot;
        android:targetSdkVersion=&quot;14&quot; /&gt;

    &lt;application
        android:allowBackup=&quot;true&quot;
        android:icon=&quot;@drawable/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot;
        android:theme=&quot;@style/AppTheme&quot; &gt;
        &lt;activity
            android:name=&quot;.MainActivity&quot;
            android:label=&quot;@string/app_name&quot; &gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;

                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        
		&lt;receiver android:name=&quot;.MyReceiver&quot;&gt;
			&lt;intent-filter&gt;
				&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
				&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
			&lt;/intent-filter&gt;
		&lt;/receiver&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</pre>这里特别注意一个&lt;activity&gt; 标签与&lt;receiver&gt;标签的构造。<span style="color:#993300;">完全相同！！！！！！！</span><br />完全相同体现在：<p></p><p></p><ul><li><span style="font-size: 12px;">1、所处位置：都直属&lt;application&gt;标签；</span></li><li><span style="font-size: 12px;">2、参数构造基本一样；都有android:name,都有&lt;intent-filter&gt;；</span></li><li><span style="font-size: 12px;">3、都是通过Intent传递参数，也都是通过Intent进行匹配！！！！</span></li></ul><p></p><p>这说明了一个问题：receiver是activity的变种！！！！！我没有研究源码，但仅从这些相同点来看，他们肯定是从一个共同的类派生出来的。（猜想）</p><p><strong>最后是发送广播：</strong></p><p>我们在主页面加一个Button，当点击Button时发送广播消息。</p><p>布局文件如下：（activity_main.xml）</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_4_3024154"  code_snippet_id="454999" snippet_file_name="blog_20140821_4_3024154" name="code" class="html">&lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;
    tools:context=&quot;com.example.test_brocast_blog.MainActivity&quot; &gt;

   &lt;Button
        android:id=&quot;@+id/sent_btn&quot;
        android:layout_width=&quot;wrap_content&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:text=&quot;发送Broadcast&quot; /&gt;

&lt;/RelativeLayout&gt;</pre>代码如下：（MainActivity.java）<br /><pre code_snippet_id="454999" snippet_file_name="blog_20140820_5_2373267"  code_snippet_id="454999" snippet_file_name="blog_20140820_5_2373267" name="code" class="java">public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        Button btn= (Button)findViewById(R.id.sent_btn);
        btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				send();
			}
		});
        
    }
    
    public void send() {
    	Intent intent = new Intent(&quot;android.intent.action.MY_BROADCAST&quot;);
    	intent.putExtra(&quot;msg&quot;, &quot;hello receiver.&quot;);
    	sendBroadcast(intent);
    }
}</pre>真正的发送代码在send()函数中，在这个函数中可以看到，我们通过传进去刚才注册的MyRecevier的action，来构造一个隐式Intent，然后利用PutExtra放进去一个额外信息（这个不是必须的，我们仅仅是为了跟踪这个消息传到了哪里去，在《详解Intnent》系统文章中有讲怎样构造一个隐式Intent），与StartActivity不同的是，这里利用的是sendBroadcast(intent)来发送这个Intent；<br />效果图：<p></p><p><br /></p><p><img src="http://img.blog.csdn.net/20140820205407838?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFydmljODgwOTI1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /></p><p><img src="http://img.blog.csdn.net/20140820205425575?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFydmljODgwOTI1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="font-size: 12px;" alt="" /></p><p><span style="color:#660000;">这里注意一下应用名！！！！（com.example.test_brocast_blog）后面会用到。</span></p><p><br /></p><h3>2、动态注册实例程序</h3><p>前面，我们说了静态注册，什么叫静态注册呢，就是利用XML来注册。</p><p>相反，利用代码来注册的就叫动态注册。</p><p><strong>静态注册和动态注册是有区别的，主要体现在接收上。</strong></p><p><span style="color:#660000;">静态注册的程序，无论该程序是否启动，都会当广播到来时接收，并处理。而动态注册的程序只有在程序运行时才会收到广播消息，程序不运行了，它就收不到了。</span></p><p>动态注册的代码如下：</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_6_4952837"  code_snippet_id="454999" snippet_file_name="blog_20140821_6_4952837" name="code" class="java">MyReceiver receiver = new MyReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(&quot;android.intent.action.MY_BROADCAST&quot;);
        
registerReceiver(receiver, filter);</pre>同样，首先生成我们要接收的类的实例，然后利用IntentFilter来声明他可以匹配的广播类型（这里利用动作来匹配），最后利用registerReceiver(receiver, filter);来注册，即利用当哪种类型的Intent广播到来时，要调用MyReceiver类。<p></p><p><span style="color:#660000;">注意：发送广播之前，要先注册，不然根本没有接收者匹配，当然，不注册接收者也不会出现任何错误或警告，只是发送一个没有任何接收者的广播播毫无意义。</span><br /><strong>下面我们新建一个项目，取名叫：Test_Brocast_Blog_Dynamic</strong></p><p>同样，写一个MyRecever类来接收广播，MyRecever类内容不变：</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_7_3529305"  code_snippet_id="454999" snippet_file_name="blog_20140821_7_3529305" name="code" class="java">public class MyReceiver extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		String msg = intent.getStringExtra(&quot;msg&quot;);  
        Log.i(TAG, msg);  
	}

}</pre>然后同样，给MainActivity布局里添加一个Button，当点击Button时发送广播。布局文件与上面一样，这里我只写代码：<br /><pre code_snippet_id="454999" snippet_file_name="blog_20140821_8_2105774"  code_snippet_id="454999" snippet_file_name="blog_20140821_8_2105774" name="code" class="java">public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
      //在发送之前，确定在代码的某个位置已经动态注册
        MyReceiver receiver = new MyReceiver();
        IntentFilter filter = new IntentFilter();
        filter.addAction(&quot;android.intent.action.MY_BROADCAST&quot;);
                
        registerReceiver(receiver, filter);
        
        
        //发送广播
        Button btn= (Button)findViewById(R.id.sent_btn);
        btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				send();
			}
		});
        
        
        
    }
    
    public void send() {
    	Intent intent = new Intent(&quot;android.intent.action.MY_BROADCAST&quot;);
    	intent.putExtra(&quot;msg&quot;, &quot;hello receiver.&quot;);
    	sendBroadcast(intent);
    }

}</pre>在OnCreate（）里在注册广播接收者，即告诉系统，当这个广播到来时，用MyReciver来接收。然后点击发送按钮来发送广播。<br /><span style="color:#660000;">注：（在运行这个程序之前，先把静态注册的APP装到手机上，这是下面得出结论的前提）</span><p></p><p>结果如下：</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 操作界面&nbsp;</p><p><img src="http://img.blog.csdn.net/20140821104620843?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFydmljODgwOTI1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /><br /></p><p>结果：</p><p><img src="http://img.blog.csdn.net/20140821104853271?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFydmljODgwOTI1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" /><br /></p><p>咦？怎么出来两条信息？</p><p>也就是说有两个接收者接收到了这条广播，但我们这里只注册了一个MyRecever实例啊。</p><p>对的，看应用名称就可以看得出，这是两个不同的应用，有一个是静态注册的（com.example.test_brocast_blog），所以静态注册的程序不管是否启动，都可以收得到匹配的广播的，并对这个广播操作。</p><p>如果想试一下，动态注册的代码能不能收到广播，可以反过来一下，运行静态注册的程序，把动态注册的程序关掉，看出来几条Log？答案肯定是一条！因为我们都知道动态注册的代码在程序不运行时是收不到广播的。</p><p><br /></p><h2>三、普通广播与有序广播</h2><p><span style="color:#006600;">普通广播</span>是指大家等级都是一样的，当广播到来时，都能一块接收到，并没有接收的先后顺序。由于是一同接收到的，所以一个接收者是没有办法阻止另一个接收者接收这个广播的。</p><p><span style="color:#006600;">有序广播</span>是指接收是按一定的优先级顺序来接收的，优先级高的先收到，并可以对广播进行操作后，再传给下一个接收者，当然也可以不传，如果不传的话，后面的接收者就都收不到这个广播了。</p><p><strong>普通广播</strong></p><p><span style="color:#660000;">（在运行这个程序之前，先把手机上前两个APP全部删除，以免影响结果）</span></p><p>首先我们建三个接收者，并对他们全部静态注册。三个接收者的代码分别如下：</p><p>FirstRecever：<br /></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_9_9872186"  code_snippet_id="454999" snippet_file_name="blog_20140821_9_9872186" name="code" class="java">public class FirstRecever extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		String msg = intent.getStringExtra(&quot;msg&quot;);  
        Log.i(TAG, &quot;FirstRecever：&quot;+msg);  
	}
}</pre>SecondRecever：<p></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_10_2522146"  code_snippet_id="454999" snippet_file_name="blog_20140821_10_2522146" name="code" class="java">public class SecondRecever extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		String msg = intent.getStringExtra(&quot;msg&quot;);  
        Log.i(TAG, &quot;SecondRecever：&quot;+msg);  
	}
}</pre><p></p><p>MyReceiver<br /></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_11_2871593"  code_snippet_id="454999" snippet_file_name="blog_20140821_11_2871593" name="code" class="java">public class MyReceiver extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		String msg = intent.getStringExtra(&quot;msg&quot;);  
        Log.i(TAG, &quot;MyReceiver：&quot;+msg);  
	}
}</pre>注册代码如下：（AndroidManifest.xml）<br /><pre code_snippet_id="454999" snippet_file_name="blog_20140821_12_4093092"  code_snippet_id="454999" snippet_file_name="blog_20140821_12_4093092" name="code" class="html">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.example.test_brodcast&quot;
    android:versionCode=&quot;1&quot;
    android:versionName=&quot;1.0&quot; &gt;

    &lt;uses-sdk
        android:minSdkVersion=&quot;14&quot;
        android:targetSdkVersion=&quot;14&quot; /&gt;

    &lt;application
        android:allowBackup=&quot;true&quot;
        android:icon=&quot;@drawable/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot;
        android:theme=&quot;@style/AppTheme&quot; &gt;
        &lt;activity
            android:name=&quot;.MainActivity&quot;
            android:label=&quot;@string/app_name&quot; &gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;

                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
            
        &lt;/activity&gt;
        &lt;!-- 分别注册这三个接收器 --&gt;
         &lt;receiver android:name=&quot;.MyReceiver&quot;&gt;
        	&lt;intent-filter&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        
         &lt;receiver android:name=&quot;.FirstRecever&quot;&gt;
        	&lt;intent-filter&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        
         &lt;receiver android:name=&quot;.SecondRecever&quot;&gt;
        	&lt;intent-filter&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        
    &lt;/application&gt;

&lt;/manifest&gt;</pre>同样，我们在MainActivity中添加一个Button，当点击按钮时发送广播，MainActivity代码如下：<p></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_13_5281571"  code_snippet_id="454999" snippet_file_name="blog_20140821_13_5281571" name="code" class="html">public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        Button btn= (Button)findViewById(R.id.sent_btn);
        btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				send();
			}
		});
        
    }
    
    public void send() {
    	Intent intent = new Intent(&quot;android.intent.action.MY_BROADCAST&quot;);
    	intent.putExtra(&quot;msg&quot;, &quot;hello receiver.&quot;);
    	sendBroadcast(intent);
    }

}</pre>运行程序，结果：<br /><img src="http://img.blog.csdn.net/20140821113339502?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFydmljODgwOTI1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" /><br />可见，三个全都收到了广播。<p></p><p><strong>有序广播（无访问权限版）</strong></p><p>首先有序广播与普通广播的不同点在发送和接收都有不同。</p><p><strong>首在发送有序广播：</strong></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_14_5773284"  code_snippet_id="454999" snippet_file_name="blog_20140821_14_5773284" name="code" class="html">public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        Button btn= (Button)findViewById(R.id.sent_btn);
        btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				send();
			}
		});
        
    }
    
    public void send() {
    	
    	Intent intent = new Intent(&quot;android.intent.action.MY_BROADCAST&quot;);  
        intent.putExtra(&quot;msg&quot;, &quot;hello receiver.&quot;);  
        sendOrderedBroadcast(intent, null);  //没有添加权限
    }
}</pre>在前面的各个例子中，我们发送广播都是用的：sendBroadcast(intent); 而这里却用的是：sendOrderedBroadcast(intent, null); &nbsp;<p></p><p>对这个函数的官方解释是：</p><p></p><h4 class="jd-details-title" style="line-height: 21px; font-size: 1.15em; margin: 1.5em 0px 0.6em; font-weight: 500; padding: 3px 95px 3px 3px; color: rgb(34, 34, 34); font-family: Roboto, sans-serif; background-color: rgb(226, 226, 226);"><span class="normal">public abstract void&nbsp;</span><span class="sympad" style="margin-right: 2px;">sendOrderedBroadcast</span>&nbsp;<span class="normal">(<a target=_blank target="_blank" href="http://developer.android.com/reference/android/content/Intent.html" style="color: rgb(37, 138, 175); text-decoration: none;">Intent</a>&nbsp;intent,&nbsp;<a target=_blank target="_blank" href="http://developer.android.com/reference/java/lang/String.html" style="color: rgb(37, 138, 175); text-decoration: none;">String</a>&nbsp;receiverPermission)</span></h4><div class="api-level" style="font-size: 0.8em; color: rgb(153, 153, 153); float: right; padding: 0px 8px; margin-top: -30px; font-family: Roboto, sans-serif; line-height: 19px; background-color: rgb(249, 249, 249);">Added in&nbsp;<a target=_blank target="_blank" href="http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels" style="color: rgb(37, 138, 175); text-decoration: none;">API level 1</a></div><div class="jd-details-descr" style="padding: 0px; margin: 0.5em 0.25em; color: rgb(34, 34, 34); font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px; background-color: rgb(249, 249, 249);"><div class="jd-tagdata jd-tagdescr" style="margin: 0.25em 0px 0.75em;"><p style="margin-top: 0px; margin-bottom: 1em; margin-left: 1em;">Broadcast the given intent to all interested BroadcastReceivers, delivering them one at a time to allow more preferred receivers to consume the broadcast before it is delivered to less preferred receivers. This call is asynchronous; it returns immediately, and you will continue executing while the receivers are run.</p><p style="margin-top: 0px; margin-bottom: 1em; margin-left: 1em;">See&nbsp;<code style="font-size: 13px; color: rgb(0, 102, 0); line-height: 14px;"><a target=_blank target="_blank" href="http://developer.android.com/reference/android/content/BroadcastReceiver.html" style="color: rgb(37, 138, 175); text-decoration: none;">BroadcastReceiver</a></code>&nbsp;for more information on Intent broadcasts.</p></div><div class="jd-tagdata" style="margin: 0.5em 1em;"><h5 class="jd-tagtitle" style="font-size: 1em; margin: 0px 0px 0.25em;">Parameters</h5><table class="jd-tagtable    " style="font-size: 1em; margin: 0px; border-collapse: collapse; border-spacing: 0px; border: 0px; width: auto; background-color: transparent;"><tbody><tr><th style="padding: 2px 10px; vertical-align: top; color: inherit; border: none; font-weight: normal; font-style: italic; background-color: transparent;">intent</th><td style="padding: 2px 10px; vertical-align: top; border: none; background-color: transparent;">The Intent to broadcast; all receivers matching this Intent will receive the broadcast.</td></tr><tr><th style="padding: 2px 10px; vertical-align: top; color: inherit; border: none; font-weight: normal; font-style: italic; background-color: transparent;">receiverPermission</th><td style="padding: 2px 10px; vertical-align: top; border: none; background-color: transparent;">(optional) String naming a permissions that a receiver must hold in order to receive your broadcast. If null, no permission is required.</td></tr></tbody></table></div></div>其中第二个参数是指定接收者必须拥有的接收权限，如果设为NUll，就是不需要接收权限，所有匹配的Receiver都能接收到。我们这里先不需要权限试试看，下面再举个需要权限的例子。<br /><strong>接收端</strong><p></p><p>我们上面说了，接收端必须是有序的，是有优先级的，这种优先级是在注册时配置的，比如：</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_15_3091089"  code_snippet_id="454999" snippet_file_name="blog_20140821_15_3091089" name="code" class="html"> &lt;receiver android:name=&quot;.FirstRecever&quot;&gt;
	&lt;intent-filter android:priority=&quot;10&quot;&gt;
		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
	&lt;/intent-filter&gt;
&lt;/receiver&gt;</pre>与上面静态注册的不同在于，在Intent-filter中添加一个android:priority=&quot;10&quot;属性，这个就是接收器优先级，数字越大的接收器，优先级越高，越先接到广播。<br />同样，上面我们三个类FirstRecever、SecondRecever和MyReceiver 的注册文件代码如下 ：<p></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_16_3199773"  code_snippet_id="454999" snippet_file_name="blog_20140821_16_3199773" name="code" class="html">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.example.testbroast_order&quot;
    android:versionCode=&quot;1&quot;
    android:versionName=&quot;1.0&quot; &gt;

    &lt;uses-sdk
        android:minSdkVersion=&quot;14&quot;
        android:targetSdkVersion=&quot;14&quot; /&gt;

    &lt;application
        android:allowBackup=&quot;true&quot;
        android:icon=&quot;@drawable/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot;
        android:theme=&quot;@style/AppTheme&quot; &gt;
        &lt;activity
            android:name=&quot;.MainActivity&quot;
            android:label=&quot;@string/app_name&quot; &gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;

                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        

         &lt;receiver android:name=&quot;.FirstRecever&quot;&gt;
        	&lt;intent-filter android:priority=&quot;10&quot;&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        
         &lt;receiver android:name=&quot;.SecondRecever&quot;&gt;
        	&lt;intent-filter android:priority=&quot;9&quot;&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        
        &lt;receiver android:name=&quot;.MyReceiver&quot;&gt;
        	&lt;intent-filter android:priority=&quot;8&quot;&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        &lt;!-- 接收优先级逐级降低 --&gt;
    &lt;/application&gt;

&lt;/manifest&gt;</pre>最后是代码部分<br />前面我也曾提到，在一个接收器收到发来的Intent后，可以对其进行更改，对发送来的广播Intent进行修改是利用setResultExtras(bundle); &nbsp;函数来实现的。<p></p><p></p><h4 class="jd-details-title" style="line-height: 21px; font-size: 1.15em; margin: 1.5em 0px 0.6em; font-weight: 500; padding: 3px 95px 3px 3px; color: rgb(34, 34, 34); font-family: Roboto, sans-serif; background-color: rgb(226, 226, 226);"><span class="normal">public final void&nbsp;</span><span class="sympad" style="margin-right: 2px;">setResultExtras</span>&nbsp;<span class="normal">(<a target=_blank target="_blank" href="http://developer.android.com/reference/android/os/Bundle.html" style="color: rgb(37, 138, 175); text-decoration: none;">Bundle</a>&nbsp;extras)</span></h4><div class="api-level" style="font-size: 0.8em; color: rgb(153, 153, 153); float: right; padding: 0px 8px; margin-top: -30px; font-family: Roboto, sans-serif; line-height: 19px; background-color: rgb(249, 249, 249);">Added in&nbsp;<a target=_blank target="_blank" href="http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels" style="color: rgb(37, 138, 175); text-decoration: none;">API level 1</a></div><div class="jd-details-descr" style="padding: 0px; margin: 0.5em 0.25em; color: rgb(34, 34, 34); font-family: Roboto, sans-serif; font-size: 14px; line-height: 19px; background-color: rgb(249, 249, 249);"><div class="jd-tagdata jd-tagdescr" style="margin: 0.25em 0px 0.75em;"><p style="margin-top: 0px; margin-bottom: 1em; margin-left: 1em;">Change the current result extras of this broadcast; only works with broadcasts sent through&nbsp;<code style="font-size: 13px; color: rgb(0, 102, 0); line-height: 14px;"><a target=_blank target="_blank" href="http://developer.android.com/reference/android/content/Context.html#sendOrderedBroadcast(android.content.Intent, java.lang.String)" style="color: rgb(37, 138, 175); text-decoration: none;">Context.sendOrderedBroadcast</a></code>. This is a Bundle holding arbitrary data, whose interpretation is up to the broadcaster. Can be set to null. Calling this method completely replaces the current map (if any).</p><p style="margin-top: 0px; margin-bottom: 1em; margin-left: 1em;"><strong>This method does not work with non-ordered broadcasts such as those sent with&nbsp;<code style="font-size: 13px; color: rgb(0, 102, 0); font-weight: normal; line-height: 14px;"><a target=_blank target="_blank" href="http://developer.android.com/reference/android/content/Context.html#sendBroadcast(android.content.Intent)" style="color: rgb(37, 138, 175); text-decoration: none;">Context.sendBroadcast</a></code></strong></p><p style="margin-top: 0px; margin-bottom: 1em; margin-left: 1em;"></p></div><div class="jd-tagdata" style="margin: 0.5em 1em;"><h5 class="jd-tagtitle" style="font-size: 1em; margin: 0px 0px 0.25em;">Parameters</h5><table class="jd-tagtable    " style="font-size: 1em; margin: 0px; border-collapse: collapse; border-spacing: 0px; border: 0px; width: auto; background-color: transparent;"><tbody><tr><th style="padding: 2px 10px; vertical-align: top; color: inherit; border: none; font-weight: normal; font-style: italic; background-color: transparent;">extras</th><td style="padding: 2px 10px; vertical-align: top; border: none; background-color: transparent;">The new extra data map; may be null.</td></tr></tbody></table></div></div><strong><span style="color:#006600;">翻译一下：</span></strong><p></p><p><span style="color:#006600;">这个函数是用来改变当前广播传来的Extra额外信息的；它只能通过<code style="font-size: 13px; line-height: 14px; background-color: rgb(249, 249, 249);"><a target=_blank target="_blank" href="http://developer.android.com/reference/android/content/Context.html#sendOrderedBroadcast(android.content.Intent, java.lang.String)" style="text-decoration: none;">Context.sendOrderedBroadcast</a></code><span style="font-family: Roboto, sans-serif; font-size: 14.44444465637207px; line-height: 19px; background-color: rgb(249, 249, 249);">.</span>发送过来的广播有效；它使用Bundle来传递任意的数据，而这些数据只有接收器（broadcaster）才能解析。当然也可以把它设置为NULL，这样，它就把传来的数据映射全部清空了。</span></p><p><span style="color:#006600;">参数：</span></p><p><span style="color:#006600;">extras:新的数据映射，可以为空。</span></p><p>从上面的优先级可以看出，这里三个类的接收顺序是这样的：FirstRecever-》SecondRecever-》MyReceiver</p><p>下面看看FirstRecever如何利用setResultExtras来改变传来的Msg信息：</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_17_7452914"  code_snippet_id="454999" snippet_file_name="blog_20140821_17_7452914" name="code" class="java">public class FirstRecever extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		//先获得传过来的MSG
		String msg = intent.getStringExtra(&quot;msg&quot;);  
        Log.i(TAG, &quot;FirstRecever：&quot;+msg);  
		
        //更改广播数据
		 Bundle bundle = new Bundle();  
	     bundle.putString(&quot;msg&quot;, msg + &quot;@FirstReceiver&quot;);  
	     setResultExtras(bundle);  
	}
}</pre>首先，我们利用getStringExtra（）获得传过来的msg消息，然后利用bundle重新封装一个以“msg”为key的消息，把&quot;@FirstReceiver&quot;添加到消息里，表示经过了这里。<br /><p>最后利用setResultExtras(bundle); &nbsp;修改当前的结果集。</p><p><strong><span style="color:#006600;">如果想终止消息往下一个接收器传递，可以使用：abortBroadcast(); &nbsp;//终止消息再传递</span></strong></p><p><span style="color:#660000;">这里有一个疑问：我利用setResultExtras(bundle); 修改传送结果，对原来广播过来的数据有影响吗？下面我们就在SecondRecever中做个测试</span></p><p></p><p>下面看看另外两个接收器代码：SecondRecever</p><p></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_18_5294107"  code_snippet_id="454999" snippet_file_name="blog_20140821_18_5294107" name="code" class="java">public class SecondRecever extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub        
     
       //先获得广播过来的MSG
      	String broadcast_msg = intent.getStringExtra(&quot;msg&quot;);  
        Log.i(TAG, &quot;SecondRecever--broadcast_msg：&quot;+broadcast_msg);  
        
        //接收通过setResultExtras传过来的msg
        String msg = getResultExtras(true).getString(&quot;msg&quot;);  
        Log.i(TAG, &quot;SecondReceiver: &quot; + msg);  
        
        //修改setResultExtras传来的结果
        Bundle bundle = new Bundle();  
        bundle.putString(&quot;msg&quot;, msg + &quot;@SecondReceiver&quot;);  
        setResultExtras(bundle);  
	}
}</pre>这里先通过intent.getStringExtra(&quot;msg&quot;); &nbsp;获得广播过来的数据；<p></p><p>然后再利用getResultExtras(true).getString(&quot;msg&quot;); &nbsp;获得上一级传过来的setResultExtras(bundle); &nbsp;里的数据；<br />最后重新将bundle里的数据中添加&quot;@SecondReceiver&quot;做个标记；</p>最后，MyReceiver：<p></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_19_5992218"  code_snippet_id="454999" snippet_file_name="blog_20140821_19_5992218" name="code" class="java">public class MyReceiver extends BroadcastReceiver {

	private static final String TAG = &quot;MyReceiver&quot;;  
	
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub

		String msg = getResultExtras(true).getString(&quot;msg&quot;);  
        Log.i(TAG, &quot;MyReceiver: &quot; + msg);  
	}
}</pre><p></p>到这就所有就序了，运行下代码：<br /><img src="http://img.blog.csdn.net/20140821135150890?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFydmljODgwOTI1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" /><br /><p>从结果可以看出：<span style="font-size: 12px;">通过setResultExtras(bundle); &nbsp;传递的数据是不会更改原生广播的数据的。也只是原来广播数据中额外添加的数据。</span></p><p><br /></p><p><span style="font-weight: bold;">有序广播（添加访问权限版）</span><br /></p><p>前面我们看到在sendOrderedBroadcast(intent, null); &nbsp;中，第二个参数可以设定访问权限，在上个例子中，我们并没有加入访问权限，下面我们就发送一个带权限的广播：</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_20_3061398"  code_snippet_id="454999" snippet_file_name="blog_20140821_20_3061398" name="code" class="java">public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btn= (Button)findViewById(R.id.sent_btn);
        btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				send();
			}
		});
        
    }
    
    public void send() {
    	
    	Intent intent = new Intent(&quot;android.intent.action.MY_BROADCAST&quot;);  
        intent.putExtra(&quot;msg&quot;, &quot;hello receiver.&quot;);  
        sendOrderedBroadcast(intent, &quot;harvic.broadcast.perssion&quot;); 
    }
}</pre>这段代码中，我们利用&nbsp;sendOrderedBroadcast(intent, &quot;harvic.broadcast.perssion&quot;); 发送一个必须拥有&quot;harvic.broadcast.perssion&quot;权限的接收器才能接收到我们的广播；<br />然后我们要在接收器中加入声明使用权限的代码：<p></p><p>有关权限的声明与使用，可以参考这篇文章：<a target=_blank target="_blank" href="http://blog.csdn.net/harvic880925/article/details/38683625">《声明、使用与自定义权限》</a></p><p>首先创建一个&quot;harvic.broadcast.perssion&quot;权限</p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_21_3410845"  code_snippet_id="454999" snippet_file_name="blog_20140821_21_3410845" name="code" class="java"> &lt;permission android:name=&quot;harvic.broadcast.perssion&quot; android:protectionLevel=&quot;normal&quot;&gt;&lt;/permission&gt; </pre>然后是底部声明，我们要使用这个权限：<p></p><p></p><pre code_snippet_id="454999" snippet_file_name="blog_20140821_22_1567682"  code_snippet_id="454999" snippet_file_name="blog_20140821_22_1567682" name="code" class="java">&lt;uses-permission  android:name=&quot;harvic.broadcast.perssion&quot;/&gt;</pre>所以总体的代码如下：<br /><pre code_snippet_id="454999" snippet_file_name="blog_20140821_23_1917129"  code_snippet_id="454999" snippet_file_name="blog_20140821_23_1917129" name="code" class="java">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.example.testbroadcast_order_perssion&quot;
    android:versionCode=&quot;1&quot;
    android:versionName=&quot;1.0&quot; &gt;

    &lt;uses-sdk
        android:minSdkVersion=&quot;14&quot;
        android:targetSdkVersion=&quot;14&quot; /&gt;
    &lt;permission android:name=&quot;harvic.broadcast.perssion&quot; android:protectionLevel=&quot;normal&quot;&gt;&lt;/permission&gt; 

    &lt;application
        android:allowBackup=&quot;true&quot;
        android:icon=&quot;@drawable/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot;
        android:theme=&quot;@style/AppTheme&quot; &gt;
        &lt;activity
            android:name=&quot;.MainActivity&quot;
            android:label=&quot;@string/app_name&quot; &gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;

                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        
        
        &lt;receiver android:name=&quot;.FirstRecever&quot; &gt;
        	&lt;intent-filter android:priority=&quot;10&quot;&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        
         &lt;receiver android:name=&quot;.SecondRecever&quot; &gt;
        	&lt;intent-filter android:priority=&quot;9&quot;&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        
        &lt;receiver android:name=&quot;.MyReceiver&quot; &gt;
        	&lt;intent-filter android:priority=&quot;8&quot;&gt;
        		&lt;action android:name=&quot;android.intent.action.MY_BROADCAST&quot;/&gt;
        		&lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
        	&lt;/intent-filter&gt;
        &lt;/receiver&gt;
        &lt;!-- 接收优先级逐级降低 --&gt;
        
    &lt;/application&gt;
   
    &lt;!-- 如果不添加使用权限声明，那么接收器会拒绝接受消息的，所以在Log中不会有任何显示 --&gt;
    &lt;uses-permission  android:name=&quot;harvic.broadcast.perssion&quot;/&gt;

&lt;/manifest&gt;</pre>其它接收器代码不变，运行之后：<p></p><p><img src="http://img.blog.csdn.net/20140821165619203?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFydmljODgwOTI1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" /><br />有个地方要注意：即便像我们现在这样，自己的应用发出广播给自己接收，但如果不声明使用权限，是不能接收到广播的。这点与Activity的权限机制不一样，在Activity中，只要在同一个应用中相互App跳转，是不需要声明使用权限的，权限的限制只针对其它应用调用此Activity。<br /><br /></p><p>好啦，这篇文章到这就结束了。本篇内容比较多，涉及到的代码工程也比较多，现将相关源码列表如下：</p><p>1、静态注册源码<br /><span style="font-size: 12px;">2、动态注册源码<br /></span><span style="font-size: 12px;">3、普通接收源码<br /></span><span style="font-size: 12px;">4、有序广播（无访问权限）源码<br /></span><span style="font-size: 12px;">5、有序广播（添加访问权限）源码<br /></span><span style="font-size: 12px;">6、本文所用图片</span></p><p><span style="font-size: 12px;"><br /></span></p><p><span style="font-size: 12px;">注意：在OnReceive中保存传过来值的问题：</span></p><p><span style="font-size: 12px;">如果有下面一段伪代码：</span></p><p><span style="font-size: 12px;">class xxxx{</span></p><p><span style="font-size: 12px;">private int mData=1;</span></p><p><span style="font-size: 12px;">public void onReceive(Context context, Intent intent)</span></p><p><span style="font-size: 12px;"><span style="white-space:pre">	</span></span>Log.d(&quot;tag&quot;,mData + &quot;&quot;);</p><p><span style="white-space: pre;">	</span>mData = intent.getIntExtra(&quot;intdata&quot;,-1);</p><p>}</p><p>如果我们通过intent传过来的值保存在mData中，在下次再来的时候先打出来mData的值，会发现，每次打出来的都是1，所以根本没有办法通过成员变量保存onReceive中传过来的值。</p><p><br /></p><p><span style="font-size:18px;color:#660000;"><strong>源码下载地址：<a target=_blank target="_blank" href="http://download.csdn.net/detail/harvic880925/7797869">http://download.csdn.net/detail/harvic880925/7797869</a></strong></span></p><p><span style="font-size:18px;color:#660000;"><strong>请大家尊重原创者版权，转载请标明出处：<a target=_blank target="_blank" href="http://blog.csdn.net/harvic880925/article/details/38710901">http://blog.csdn.net/harvic880925/article/details/38710901</a>&nbsp;谢谢！</strong></span></p><p><br /></p>   
</div>




<!-- Baidu Button BEGIN -->




<div class="bdsharebuttonbox tracking-ad" style="float: right;" data-mod="popu_172">
<a href="#" class="bds_more" data-cmd="more" style="background-position:0 0 !important; background-image: url(http://bdimg.share.baidu.com/static/api/img/share/icons_0_16.png?v=d754dcc0.png) !important"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"  style="background-position:0 -52px !important"></a>
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"style="background-position:0 -104px !important"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"style="background-position:0 -260px !important"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"style="background-position:0 -208px !important"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"style="background-position:0 -1612px !important" ></a>
</div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<!-- Baidu Button END -->

   <link rel="stylesheet" href="http://static.blog.csdn.net/css/blog_detail.css" />

    
<!--172.16.140.14-->

<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=1536434" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
    document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->

 

        <div id="digg" ArticleId="38710901" >
            <dl id="btnDigg" class="digg digg_disable"  onclick="btndigga();">
               
                 <dt>顶</dt>
                <dd>11</dd>
            </dl>
           
              
            <dl id="btnBury" class="digg digg_disable"  onclick="btnburya();">
              
                  <dt>踩</dt>
                <dd>0</dd>               
            </dl>
            
        </div>
     <div class="tracking-ad" data-mod="popu_222"><a href="javascript:void(0);" >&nbsp;</a>   </div>
    <div class="tracking-ad" data-mod="popu_223"> <a href="javascript:void(0);" >&nbsp;</a></div>
    <script type="text/javascript">
                function btndigga() {
                    $(".tracking-ad[data-mod='popu_222'] a").click();
                }
                function btnburya() {
                    $(".tracking-ad[data-mod='popu_223'] a").click();
                }
            </script>

   <ul class="article_next_prev">
                <li class="prev_article"><span  onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian']);location.href='/harvic880925/article/details/38701351';">上一篇</span><a href="/harvic880925/article/details/38701351" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian'])">Menu详解（二）：利用XML生成菜单和子菜单</a></li>
                <li class="next_article"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian']);location.href='/harvic880925/article/details/38733857';">下一篇</span><a href="/harvic880925/article/details/38733857" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian'])">Menu详解（三）：使用上下文菜单</a></li>
    </ul>

    <div style="clear:both; height:10px;"></div>


        <div class="similar_article"  style="display:none">
                <h4>我的同类文章</h4>
                <div class="similar_c"style="margin:20px 0px 0px 0px">
                    <div class="similar_c_t">
                                <label class="similar_cur">
                                    <span  style="cursor:pointer"  onclick="GetCategoryArticles('1707319','harvic880925','foot','38710901');">5、andriod开发<em>（148）</em></span>
                                </label>
                    </div>
                   
                    <div class="similar_wrap tracking-ad" data-mod="popu_141"  style="max-height:195px;">
                        <a href="http://blog.csdn.net" style="display:none">http://blog.csdn.net</a>
                        <ul class="similar_list fl">                          
                        </ul>

                        <ul class="similar_list fr">                           
                        </ul>
                    </div>
                </div>
            </div>    
    <script  type="text/javascript">
        $(function () {
            GetCategoryArticles('1707319', 'harvic880925','foot','38710901');
        });
    </script>
      
</div>
<div id="suggest"></div>
         <script  language="javascript" type='text/javascript'>     
             $(function(){
                 $.get("/harvic880925/svc/GetSuggestContent/38710901",function(data){
                     $("#suggest").html(data);
                 });     
             });             
         </script>  


<style>
.blog-ass-articl dd {
color: #369;
width: 99%; /*修改行*/
float: left;
overflow: hidden;
font: normal normal 12px/23px "SimSun";
height: 23px;
margin: 0;
padding: 0 0 0 10px;
margin-right: 30px;
background: url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;
}
</style>

 <link rel="stylesheet" href="http://static.blog.csdn.net/css/replace.css"/>
<div id="relate" data-mod="popu_218"  class="tracking-ad">
        <div class="relate_t">
            <h3><span>参考知识库</span></h3>
        </div>
        <div class="relate_c">
        </div>
</div>
 

<dl class="blog-ass-articl" id="res-relatived" > 
    <div class="embody embody_b" id="libkeyparent"  style="display:none">
            <span class="embody_t">更多资料请参考：</span>
            <div class="embody_c" id="libkey"></div>
    </div>


     <dt><span>猜你在找</span></dt>    


   


    <div id="adCollege" style="width: 42%;float: left;"> 
        <script src="http://csdnimg.cn/jobreco/job_reco.js" type="text/javascript"></script> 
        <script type="text/javascript">
            csdn.position.showEdu({
                sourceType: "blog",
                searchType: "detail",
                searchKey: "38710901",
                username: "",
                recordcount: "5",
                containerId: "adCollege" //容器DIV的id。 
            });
        </script> 
    </div>  

    
     <div id="res"  data-mod="popu_36"  class="tracking-ad" style="width: 42%;float: left;margin-right: 30px;"></div>
   
</dl>


<script type="text/javascript">
    $(function () {
        setTimeout(function () {
            var searchtitletags = 'BroadcastReceiver详解' + ',' + $("#tags").html();
            searchService({
                index: 'blog',
                query: searchtitletags,
                from: 5,
                size: 5,
                appendTo: '#res',
                url: 'recommend',
                his: 2,
                client: "blog_cf_enhance",
                tmpl: '<dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="#{ url }" title="#{ title }" strategy="#{ strategy }">#{ title }</a></dd>'
            });
        }, 500);
    });    

 </script>  

    <div id="ad_cen">        
                    <script type="text/javascript">
                        /*博客内容页下方Banner-728*90，创建于2014-7-3*/
                        var cpro_id = "u1607657";
                    </script>
                    <script type="text/javascript" src="http://cpro.baidustatic.com/cpro/ui/c.js"></script>
    </div>  

<div class="comment_class">
    <div id="comment_title" class="panel_head">
        <span class="see_comment">查看评论</span><a name="comments"></a></div>
    <div id="comment_list">
    </div>
    <div id="comment_bar">
    </div>
    <div id="comment_form">
    </div>
    <div class="announce">
        * 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场<a name="reply"></a><a name="quote"></a></div>
</div>

<script type="text/javascript">
    var fileName = '38710901';
    var commentscount = 6;
    var islock = false
</script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/comment.js"></script>
    <div id="ad_bot">
    </div>
<div id="report_dialog">
</div>

<div id="d-top"  style="bottom:60px;">
        <a id="quick-reply" class="btn btn-top q-reply" title="快速回复" style="display:none;">
            <img src="http://static.blog.csdn.net/images/blog-icon-reply.png" alt="快速回复">
        </a>    

    <a id="d-top-a" class="btn btn-top backtop"  style="display: none;" title="返回顶部" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_huidaodingbu'])" style="">         
         <img src="http://static.blog.csdn.net/images/top.png" alt="TOP">
    </a>
</div>
<script type="text/javascript">
    $(function ()
    {
        $("#ad_frm_0").height("90px");
        
        setTimeout(function(){
            $("#ad_frm_2").height("200px");
        },1000);    
    });
  
</script>
<style type="text/css">
    .tag_list
    {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 1px solid #D7CBC1;
        color: #000000;
        font-size: 12px;
        line-height: 20px;
        list-style: none outside none;
        margin: 10px 2% 0 1%;
        padding: 1px;
    }
    .tag_list h5
    {
        background: none repeat scroll 0 0 #E0DBD3;
        color: #47381C;
        font-size: 12px;
        height: 24px;
        line-height: 24px;
        padding: 0 5px;
        margin: 0;
    }
    .tag_list h5 a
    {
        color: #47381C;
    }
    .classify
    {
        margin: 10px 0;
        padding: 4px 12px 8px;
    }
    .classify a
    {
        margin-right: 20px;
        white-space: nowrap;
    }
</style>


<div class="tag_list" style="display:none"></div>
  <script  language="javascript" type='text/javascript'>     
      $(function(){
              setTimeout(function(){
                  $.get("/harvic880925/svc/GetTagContent",function(data){
                      $(".tag_list").html(data).show();
                  });     
              });
          },500);                       
 </script> 


<div id="pop_win" style="display:none ;position: absolute; z-index: 10000; border: 1px solid rgb(220, 220, 220); top: 222.5px; left: 630px; opacity: 1; background: none 0px 0px repeat scroll rgb(255, 255, 255);">
    
</div>
<div id="popup_mask"></div>
<style>
    #popup_mask
    {
        position: absolute;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 9999;
        left: 0px;
        top: 0px;
        opacity: 0.3;
        filter: alpha(opacity=30);
        display: none;
    }

</style>




<script type="text/javascript">
    $(function(){
        setTimeout(function(){
            $(".comment_body:contains('回复')").each(function(index,item){
                var u=$(this).text().split('：')[0].toString().replace("回复","")
                var thisComment=$(this);
                if(u)
                {
                    $.getJSON("https://passport.csdn.net/get/nick?callback=?", {users: u}, function(a) {
                        if(a!=null&&a.data!=null&&a.data.length>0)
                        {
                            nick=a.data[0].n; 
                            if(u!=nick)
                            {
                                thisComment.text(thisComment.text().replace(u,nick));  
                            }
                        }       
                    });  
                }
            });         

        },200);  

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },5000);

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },10000);

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },15000);
        
        setTimeout(function(){
            $("a img[src='http://js.tongji.linezing.com/stats.gif']").parent().css({"position":"absolute","left":"50%"});
        },300);
    });

    function loginbox(){
        var $logpop=$("#pop_win");
        $logpop.html('<iframe src="https://passport.csdn.net/account/loginbox?service=http://static.blog.csdn.net/callback.htm" frameborder="0" height="600" width="400" scrolling="no"></iframe>');

        $('#popup_mask').css({
            opacity: 0.5,
            width: $( document ).width() + 'px',
            height:  $( document ).height() + 'px'
        });
        $('#popup_mask').css("display","block");
 
        $logpop.css( {
            top: ($( window ).height() - $logpop.height())/ 2  + $( window 
       ).scrollTop() + 'px',
            left:($( window ).width() - $logpop.width())/ 2
        } );
 
        setTimeout( function () {
            $logpop.show();
            $logpop.css( {
                opacity: 1
            } );
        }, 200 );
 
        $('#popup_mask').unbind("click");
        $('#popup_mask').bind("click", function(){
            $('#popup_mask').hide();
            var $clopop = $("#pop_win");
            $("#common_ask_div_sc").css("display","none");
            $clopop.css( {
                opacity: 0
            } );
            setTimeout( function () {
                $clopop.hide();
            }, 350 );
            return false;
        });
    }   

</script>
 <script language="javascript" type="text/javascript" src="http://ads.csdn.net/js/async_new.js"></script>      


                        <div class="clear">
                        </div>
                    </div>                   
                
            </div>
                   
           <div id="side">
               
    <div class="side">


<div id="custom_column_42731546" class="panel">
<ul class="panel_head"><span>博主需要你</span></ul>
<ul class="panel_body">
<b> <font color="#ff0000">博主正在参加2016年度博客之星评选，如果博主的博客曾经帮助过您，请投我一票：<a href="http://blog.csdn.net/vote/candidate.html?username=harvic880925">http://blog.csdn.net/vote/candidate.html?username=harvic880925</a>，万分感激 </font></b>
</ul>
</div><div id="panel_Profile" class="panel">
<ul class="panel_head"><span>个人资料</span></ul>
<ul class="panel_body profile">
<div id="blog_userface">
    <a href="http://my.csdn.net/harvic880925" target="_blank">
    <img src="http://avatar.csdn.net/0/D/3/1_harvic880925.jpg" title="访问我的空间" style="max-width:90%"/>
    </a>
    <br />
    <span><a href="http://my.csdn.net/harvic880925" class="user_name" target="_blank">harvic880925</a></span>
</div>
<div class="interact">

    <a href="javascript:void(0);" class="attent" id="span_add_follow" title="[加关注]"></a>

 <a href="javascript:void(0);" class="letter"  title="[发私信]" onclick="window.open('http://msg.csdn.net/letters/model?receiver=harvic880925','_blank','height=350,width=700');_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_sixin'])"></a>  
</div>
<div id="blog_medal">
                       <div class="ico_expert"  onclick="javascript:location='http://blog.csdn.net/experts/rule.html'" title="CSDN认证专家" style="cursor:pointer;width:60px;height:60px;background:url('http://c.csdnimg.cn/jifen/images/xunzhang/xunzhang/bokezhuanjiamiddle.png') no-repeat" ></div>
                <div id="bms_box">
                                            <a  target="_blank">
                                                    <img src="http://c.csdnimg.cn/jifen/images/xunzhang/xunzhang/zhuanlandaren.png" onmouseover="m_over_m(this,2)" onmouseout="m_out_m()" alt="1" >
                                            </a>
               </div>
</div>
<ul id="blog_rank">
    <li>访问：<span>2703332次</span></li>
    <li>积分：<span>19599</span> </li>    
    <li >等级： <span style="position:relative;display:inline-block;z-index:1" >
            <img src="http://c.csdnimg.cn/jifen/images/xunzhang/jianzhang/blog7.png" alt="" style="vertical-align: middle;" id="leveImg">
            <div id="smallTittle" style=" position: absolute;  left: -24px;  top: 25px;  text-align: center;  width: 101px;  height: 32px;  background-color: #fff;  line-height: 32px;  border: 2px #DDDDDD solid;  box-shadow: 0px 2px 2px rgba (0,0,0,0.1);  display: none;   z-index: 999;">
            <div style="left: 42%;  top: -8px;  position: absolute;  width: 0;  height: 0;  border-left: 10px solid transparent;  border-right: 10px solid transparent;  border-bottom: 8px solid #EAEAEA;"></div>
            积分：19599 </div>
        </span>  </li>
    <li>排名：<span>第306名</span></li>
</ul>
<ul id="blog_statistics">
    <li>原创：<span>227篇</span></li>
    <li>转载：<span>35篇</span></li>
    <li>译文：<span>0篇</span></li>
    <li>评论：<span>2161条</span></li>
</ul>
</ul>
</div>




<div id="custom_column_41535437" class="panel">
<ul class="panel_head"><span>我的新浪微博</span></ul>
<ul class="panel_body">
<iframe width="100%" height="120" class="share_self" frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&amp;width=0&amp;height=550&amp;fansRow=1&amp;ptype=1&amp;speed=0&amp;skin=1&amp;isTitle=1&amp;noborder=1&amp;isWeibo=0&amp;isFans=0&amp;uid=5297181269&amp;verifier=30df46aa&amp;dpc=1"></iframe>
</ul>
</div>

<div id="custom_column_41299702" class="panel">
<ul class="panel_head"><span>交流群来啦</span></ul>
<ul class="panel_body">
<b><font color="#319e0b">新建了一个交流群，大家可以加入</font></b>
<br>
<b><font color="#FF0000">QQ群号一（已满）：304235209</font></b><br>
<b><font color="#FF0000">QQ群号二：554244703</font></b>
<br>
<br>
<b> <font color="#FF0000">博主需要你！！！</font></b>
<br>
<b> <font color="#319e0b">博主正在参加2016年度博客之星评选，如果博主的博客曾经帮助过您，请投我一票：<a href="http://blog.csdn.net/vote/candidate.html?username=harvic880925">http://blog.csdn.net/vote/candidate.html?username=harvic880925</a>，万分感激
</font></b>
<br>
<br>
<b><font color="#319e0b">我的微信公众号</font></b>
<br>
关注博主最新动态和干货分享,一周一次
<img style="width:95%;" src="http://img.my.csdn.net/uploads/201604/18/1460943716_5112.jpg">
<br>
<br>
<br>
<b><font color="#319e0b">另外：</font></b>
<br>
想像一下当你想学一种知识，当你工作遇到瓶颈，当你无所适从……有没有想找一个领路人来指导自己。
<br>
我就是想做一个能找到领路人的APP，让它去辅助你完成你想做的事。
如果你有这方面的需要或者建议或者想参与的话，请加Q: 1727082165 请让我听到你真实的声音。(其它勿加，谢谢)
</ul>
</div><div id="panel_Category" class="panel">
    <ul class="panel_head"><span>博客专栏</span></ul>
    <ul class="panel_body" id="sp_column">
    <table cellpadding="0" cellspacing="0"><tr>
    <td style="padding:10px 10px 0 0;">
    <a href="http://blog.csdn.net/column/details/harvic2animation.html" target="_blank"><img src="http://img.blog.csdn.net/20160311224353137" style="width:75px;height:75px;" /></a>
    </td>
    <td style="padding:10px 0; vertical-align:top;">
    <a href="http://blog.csdn.net/column/details/harvic2animation.html" target="_blank">《Animation动画详解》</a>
    <p>文章：13篇</p>
    <span>阅读：137073</span>
    </td>
    </tr></table>
    </ul>
</div><div id="panel_Category" class="panel">
<ul class="panel_head"><span>文章分类</span></ul>
<ul class="panel_body">    
                 <li>
                    <a href="/harvic880925/article/category/1707237" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">---------windows相关---------</a><span>(0)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707233" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">1、C++/VC++相关</a><span>(4)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1236187" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.1 C++基础学习心得</a><span>(7)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1236162" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.2 MFC类的使用心得</a><span>(12)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707245" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.3数据库相关</a><span>(0)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1169695" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">------------1.3.1 数据库操作</a><span>(7)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1856935" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-----------1.3.2 mysql</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1236223" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.4 COM操作</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1401677" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.5 线程</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1402759" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.6 socket</a><span>(6)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1236212" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.7 excel操作</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1425103" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------1.8 WIN32</a><span>(30)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707255" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">2、界面开发</a><span>(3)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1234151" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------2.1 MFC 界面美化</a><span>(9)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1413640" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------2.2 directUI</a><span>(5)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1418495" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------2.3 Duilib</a><span>(5)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1440839" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------2.4 GDI+</a><span>(18)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707261" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">3、视频开发</a><span>(3)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1237825" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------3.1 directShow</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1247275" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------3.2 FFMPEG</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1704271" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------3.3 openCV</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707297" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">4、PHP &amp;amp; B/S</a><span>(0)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707301" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------4.1 PHP 相关</a><span>(0)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1291119" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">--------------4.1.1 PHP</a><span>(10)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1291118" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">--------------4.1.2 zend</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707305" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">---------4.2 HTML相关</a><span>(0)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1388066" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">--------------4.2.1 HTML</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1301283" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">--------------4.2.2 CSS</a><span>(3)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707309" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------4.3 JS/JQuery</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1319101" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">--------------4.3.1  JS</a><span>(9)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1321205" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">--------------4.3.2  JQuery</a><span>(9)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1319317" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">--------------4.3.2  JQueryUI</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707319" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">5、andriod开发</a><span>(149)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707315" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">6、数据结构/算法</a><span>(0)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1628709" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------6.1 数据结构</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707317" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">7、面试</a><span>(0)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1628711" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------7.1 面试</a><span>(2)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/2329957" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">8、C#</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1707295" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">9、其它</a><span>(4)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/1169725" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">-------9.1 Grid++Report</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/harvic880925/article/category/2429723" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">linux</a><span>(2)</span>
                </li>
</ul>
</div><div id="panel_Archive" class="panel">
<ul class="panel_head"><span>文章存档</span></ul>
<ul class="panel_body">
<div id="archive_list">
<!--归档统计-->
<li><a href="/harvic880925/article/month/2016/11">2016年11月</a><span>(1)</span></li><li><a href="/harvic880925/article/month/2016/09">2016年09月</a><span>(1)</span></li><li><a href="/harvic880925/article/month/2016/08">2016年08月</a><span>(1)</span></li><li><a href="/harvic880925/article/month/2016/07">2016年07月</a><span>(3)</span></li><li><a href="/harvic880925/article/month/2016/06">2016年06月</a><span>(2)</span></li><li><a href="/harvic880925/article/month/2016/05">2016年05月</a><span>(4)</span></li><li><a href="/harvic880925/article/month/2016/04">2016年04月</a><span>(5)</span></li><li><a href="/harvic880925/article/month/2016/03">2016年03月</a><span>(5)</span></li><li><a href="/harvic880925/article/month/2016/02">2016年02月</a><span>(3)</span></li><li><a href="/harvic880925/article/month/2016/01">2016年01月</a><span>(6)</span></li><li><a href="/harvic880925/article/month/2015/12">2015年12月</a><span>(1)</span></li><li><a href="/harvic880925/article/month/2015/11">2015年11月</a><span>(6)</span></li><li><a href="/harvic880925/article/month/2015/10">2015年10月</a><span>(2)</span></li><li><a href="/harvic880925/article/month/2015/08">2015年08月</a><span>(3)</span></li><li><a href="/harvic880925/article/month/2015/07">2015年07月</a><span>(3)</span></li><li><a href="/harvic880925/article/month/2015/06">2015年06月</a><span>(2)</span></li><li><a href="/harvic880925/article/month/2015/05">2015年05月</a><span>(1)</span></li><li><a href="/harvic880925/article/month/2015/04">2015年04月</a><span>(10)</span></li><li><a href="/harvic880925/article/month/2015/03">2015年03月</a><span>(7)</span></li><li><a href="/harvic880925/article/month/2015/01">2015年01月</a><span>(4)</span></li><li><a href="/harvic880925/article/month/2014/12">2014年12月</a><span>(6)</span></li><li><a href="/harvic880925/article/month/2014/11">2014年11月</a><span>(4)</span></li><li><a href="/harvic880925/article/month/2014/10">2014年10月</a><span>(7)</span></li><li><a href="/harvic880925/article/month/2014/09">2014年09月</a><span>(5)</span></li><li><a href="/harvic880925/article/month/2014/08">2014年08月</a><span>(15)</span></li><li><a href="/harvic880925/article/month/2014/07">2014年07月</a><span>(7)</span></li><li><a href="/harvic880925/article/month/2014/06">2014年06月</a><span>(4)</span></li><li><a href="/harvic880925/article/month/2014/05">2014年05月</a><span>(6)</span></li><li><a href="/harvic880925/article/month/2014/04">2014年04月</a><span>(7)</span></li><li><a href="/harvic880925/article/month/2014/03">2014年03月</a><span>(2)</span></li><li><a href="/harvic880925/article/month/2014/01">2014年01月</a><span>(10)</span></li><li><a href="/harvic880925/article/month/2013/12">2013年12月</a><span>(17)</span></li><li><a href="/harvic880925/article/month/2013/11">2013年11月</a><span>(4)</span></li><li><a href="/harvic880925/article/month/2013/10">2013年10月</a><span>(1)</span></li><li><a href="/harvic880925/article/month/2013/09">2013年09月</a><span>(3)</span></li><li><a href="/harvic880925/article/month/2013/08">2013年08月</a><span>(3)</span></li><li><a href="/harvic880925/article/month/2013/07">2013年07月</a><span>(7)</span></li><li><a href="/harvic880925/article/month/2013/06">2013年06月</a><span>(11)</span></li><li><a href="/harvic880925/article/month/2013/05">2013年05月</a><span>(15)</span></li><li><a href="/harvic880925/article/month/2013/04">2013年04月</a><span>(14)</span></li><li><a href="/harvic880925/article/month/2013/03">2013年03月</a><span>(7)</span></li><li><a href="/harvic880925/article/month/2013/01">2013年01月</a><span>(8)</span></li><li><a href="/harvic880925/article/month/2012/12">2012年12月</a><span>(6)</span></li><li><a href="/harvic880925/article/month/2012/11">2012年11月</a><span>(1)</span></li><li><a href="/harvic880925/article/month/2012/09">2012年09月</a><span>(5)</span></li><li><a href="/harvic880925/article/month/2012/07">2012年07月</a><span>(7)</span></li><li><a href="/harvic880925/article/month/2012/06">2012年06月</a><span>(14)</span></li>
</div>
</ul>
</div>
<div id="hotarticls" class="panel">
<ul class="panel_head">
    <span>       
阅读排行    </span>
</ul>

<ul class="panel_body itemlist">
<li>
<a href="/harvic880925/article/details/40660137" title="EventBus使用详解(一)——初步使用EventBus">EventBus使用详解(一)——初步使用EventBus</a><span>(209683)</span>
</li>
<li>
<a href="/harvic880925/article/details/17680305" title="PullToRefresh使用详解（一）--构建下拉刷新的listView">PullToRefresh使用详解（一）--构建下拉刷新的listView</a><span>(134662)</span>
</li>
<li>
<a href="/harvic880925/article/details/37913801" title="android sdk离线安装">android sdk离线安装</a><span>(113299)</span>
</li>
<li>
<a href="/harvic880925/article/details/38453725" title="ViewPager 详解（一）---基本入门">ViewPager 详解（一）---基本入门</a><span>(84789)</span>
</li>
<li>
<a href="/harvic880925/article/details/40787203" title="EventBus使用详解(二)——EventBus使用进阶">EventBus使用详解(二)——EventBus使用进阶</a><span>(71219)</span>
</li>
<li>
<a href="/harvic880925/article/details/17618743" title="获取Android签名证书的sha1值">获取Android签名证书的sha1值</a><span>(60809)</span>
</li>
<li>
<a href="/harvic880925/article/details/38487149" title="ViewPager 详解（二）---详解四大函数">ViewPager 详解（二）---详解四大函数</a><span>(60188)</span>
</li>
<li>
<a href="/harvic880925/article/details/38521865" title="ViewPager 详解（三）---PagerTabStrip与PagerTitleStrip添加标题栏的异同">ViewPager 详解（三）---PagerTabStrip与PagerTitleStrip添加标题栏的异同</a><span>(53051)</span>
</li>
<li>
<a href="/harvic880925/article/details/38660861" title="ViewPager 详解（五）-----使用Fragment实现ViewPager滑动">ViewPager 详解（五）-----使用Fragment实现ViewPager滑动</a><span>(52971)</span>
</li>
<li>
<a href="/harvic880925/article/details/24722657" title="PullToRefresh使用详解（五）--下拉刷新的ScrollView">PullToRefresh使用详解（五）--下拉刷新的ScrollView</a><span>(50119)</span>
</li>
</ul>
</div>
<div id="hotarticls2" class="panel">
<ul class="panel_head"><span>评论排行</span></ul>
<ul class="panel_body itemlist">
<li>
<a href="/harvic880925/article/details/37913801" title="android sdk离线安装">android sdk离线安装</a><span>(150)</span>
</li>
<li>
<a href="/harvic880925/article/details/40660137" title="EventBus使用详解(一)——初步使用EventBus">EventBus使用详解(一)——初步使用EventBus</a><span>(112)</span>
</li>
<li>
<a href="/harvic880925/article/details/50995268" title="Android自定义控件三部曲文章索引">Android自定义控件三部曲文章索引</a><span>(77)</span>
</li>
<li>
<a href="/harvic880925/article/details/40787203" title="EventBus使用详解(二)——EventBus使用进阶">EventBus使用详解(二)——EventBus使用进阶</a><span>(73)</span>
</li>
<li>
<a href="/harvic880925/article/details/39080931" title="自定义控件之绘图篇（四）：canvas变换与操作">自定义控件之绘图篇（四）：canvas变换与操作</a><span>(65)</span>
</li>
<li>
<a href="/harvic880925/article/details/38453725" title="ViewPager 详解（一）---基本入门">ViewPager 详解（一）---基本入门</a><span>(64)</span>
</li>
<li>
<a href="/harvic880925/article/details/38487149" title="ViewPager 详解（二）---详解四大函数">ViewPager 详解（二）---详解四大函数</a><span>(57)</span>
</li>
<li>
<a href="/harvic880925/article/details/17680305" title="PullToRefresh使用详解（一）--构建下拉刷新的listView">PullToRefresh使用详解（一）--构建下拉刷新的listView</a><span>(57)</span>
</li>
<li>
<a href="/harvic880925/article/details/39996643" title="自定义控件三部曲之动画篇（一）——alpha、scale、translate、rotate、set的xml属性及用法">自定义控件三部曲之动画篇（一）——alpha、scale、translate、rotate、set的xml属性及用法</a><span>(46)</span>
</li>
<li>
<a href="/harvic880925/article/details/38557517" title="ViewPager 详解（四）----自主实现滑动指示条">ViewPager 详解（四）----自主实现滑动指示条</a><span>(46)</span>
</li>
</ul>
</div>
<div id="newcomments" class="panel">
<ul class="panel_head"><span>最新评论</span></ul>
<ul class="panel_body itemlist">
    <li>
   
         <a href="/harvic880925/article/details/44927363#comments">Fragment详解之二——基本使用方法</a>
    <p style="margin:0px;"><a href="/qq_34122135" class="user_name">qq_34122135</a>:
这篇博文写的特别详细，很容易理解。我在学习中也发现了个小问题在动态添加Fragment应该给Frag...
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/50995268#comments">Android自定义控件三部曲文章索引</a>
    <p style="margin:0px;"><a href="/xiaole0313" class="user_name">xiaole0313</a>:
谢谢分享  学习了
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/41850723#comments">详解shape标签</a>
    <p style="margin:0px;"><a href="/huaihuai1995" class="user_name">huaihuai1995</a>:
看在我给你投了那么多票的份上，这篇我转载走啦，已注明来源链接
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/52039081#comments">自定义控件三部曲之绘图篇（十八）——BitmapShader与望远镜效果</a>
    <p style="margin:0px;"><a href="/huaihuai1995" class="user_name">huaihuai1995</a>:
我都投了6票了！！！！！
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/17618743#comments">获取Android签名证书的sha1值</a>
    <p style="margin:0px;"><a href="/wlqxm" class="user_name">wlqxm</a>:
很好。谢谢了，让我正确获取到了SHA1值
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/50423762#comments">自定义控件之绘图篇（ 五）：drawText()详解</a>
    <p style="margin:0px;"><a href="/hello_xiaozhou" class="user_name">hello_xiaozhou</a>:
真的是没有之一啊！　超级赞啊，收徒弟不啊？
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/51187277#comments">自定义控件三部曲之绘图篇（八）——Paint之ColorMatrix与滤镜效果</a>
    <p style="margin:0px;"><a href="/u010407220" class="user_name">u010407220</a>:
楼主能否说一下怎么把一个图片的黑色变为透明
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/38453725#comments">ViewPager 详解（一）---基本入门</a>
    <p style="margin:0px;"><a href="/myGFZ" class="user_name">myGFZ</a>:
哈哈  已投票，初次拜读，加油加油
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/38453725#comments">Android自定义控件三部曲文章索引</a>
    <p style="margin:0px;"><a href="/tyk0910" class="user_name">tyk0910</a>:
天天都在给博主投票，加油！
    </p>
    </li>
    <li>
   
         <a href="/harvic880925/article/details/38487149#comments">ViewPager 详解（二）---详解四大函数</a>
    <p style="margin:0px;"><a href="/gjwqh" class="user_name">gjwqh</a>:
乌龟有了梦想他还是乌龟,咸鱼翻身了还是他妈的咸鱼,
    </p>
    </li>
</ul>
</div>


<div id="custom_column_42731594" class="panel">
<ul class="panel_body">
<div style="position:fixed;bottom: 0;magin:0 auto; left:0;right:0;z-index:1000;border-top:1px dashed #aaa;font-weight:bold;background-color:#fff;font-family: 'Microsoft YaHei';padding:4px;text-align:center;">

<div style=""><a href="http://blog.csdn.net/vote/candidate.html?username=harvic880925" style="text-decoration:none;line-height:40px;vertical-align:middle;color:#EA4A3E;font-size:1.5em;" target="_blank">我是启舰，正在参加2016年博客之星评选，如果我曾帮到你，请投我一票，谢谢。</a><a href="http://blog.csdn.net/vote/candidate.html?username=harvic880925"><img style="height:40px;vertical-align:middle;" src="http://img.my.csdn.net/uploads/201512/10/1449721880_6460.png"></a>
</div>

</div>
</ul>
</div>    </div>
    <div class="clear">
    </div>


                   <!-- 广告位开始 --> 
                    <ins data-revive-zoneid="190" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins> 
                    <!-- 广告位结束 -->

           </div>   

            <div class="clear">
            </div>
        </div>

        

<script type="text/javascript" src="http://c.csdnimg.cn/rabbit/cnick/cnick.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/newblog.min.js"></script>


<script type="text/javascript" src="http://medal.blog.csdn.net/showblogmedal.ashx?blogid=1268428"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/JavaScript1.js"></script>

    <script type="text/javascript" src="http://passport.csdn.net/content/loginbox/login.js"></script>
<script type="text/javascript">document.write("<img src=http://counter.csdn.net/pv.aspx?id=24 border=0 width=0 height=0>");</script>
<script type="text/javascript" src="http://www.csdn.net/ui/scripts/Csdn/counter.js"></script>
<script type="text/javascript" src="http://ad.csdn.net/scripts/ad-blog.js"></script>
<script type="text/javascript">
    $(function () {
        function __get_code_toolbar(snippet_id) {
            return $("<span class='tracking-ad' data-mod='popu_167'><a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "' target='_blank' title='在CODE上查看代码片'  style='text-indent:0;'><img src='https://code.csdn.net/assets/CODE_ico.png' width=12 height=12 alt='在CODE上查看代码片' style='position:relative;top:1px;left:2px;'/></a></span>"
                    + "<span class='tracking-ad' data-mod='popu_170'><a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "/fork' target='_blank' title='派生到我的代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/ico_fork.svg' width=12 height=12 alt='派生到我的代码片' style='position:relative;top:2px;left:2px;'/></a></span>");
        }
        
        $("[code_snippet_id]").each(function () {
            __s_id = $(this).attr("code_snippet_id");
            if (__s_id != null && __s_id != "" && __s_id != 0 && parseInt(__s_id) > 70020) {
                __code_tool = __get_code_toolbar(__s_id);
                $(this).prev().find(".tools").append(__code_tool);
            }
        });

        $(".bar").show();
    });
</script>





    </div>
      <!--new top-->
    
    <script id="csdn-toolbar-id" btnId="header_notice_num" wrapId="note1" count="5" subCount="5" type="text/javascript" src="http://c.csdnimg.cn/public/common/toolbar/js/toolbar.js"></script>     <!--new top-->
   
    <link href="http://c.csdnimg.cn/comm_ask/css/ask_float_block.css" type="text/css" rel="stylesheet" />
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/wmd.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/showdown.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/prettify.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/apps/ask_float_block.js'></script>
   

  <div id="a52b5334d" style="width: 1px; height: 1px; display: none;">
                    <script id="adJs52b5334"></script>
                    <script>document.getElementById("adJs52b5334").src = "http://ads.csdn.net/js/opt/52b5334.js?t=" + Math.random();</script>
   </div>

    <link rel="stylesheet" href="http://static.blog.csdn.net/css/blog_code.css" />
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/saveToCode.js"></script>
      <script type="text/javascript" src="//csdnimg.cn/rabbit/tracking-ad/main.js?75eacd8"></script>
</body>
</html>   
 